<template>
  <form enctype="application/x-www-form-urlencoded" id="form" method="get" action="http://localhost:3000/score/form" target="_blank" autocomplete="off">
    First name:<br>
    <input type="text" name="firstname">
    <br>
    Last name:<br>
    <input type="text" name="lastname">
    <br>
    photo:<br>
    <input type="file" name="photo">
    <div>
      <button type="reset">重置</button>
      <button type="submit" @click="getData">提交</button>
    </div>
  </form>
</template>
<script lang="ts" setup>
// import { nodeService } from '@/service/index'
import axios from 'axios'
const getData = (e:any) => {
  e.preventDefault()
  const form = document.getElementById('form') as HTMLFormElement
  const params = new FormData(form)
  console.dir(params.get('firstname'))
  axios.put('http://localhost:3000/score/form', params).then((res:any) => {
    console.log(res)
  })
  // nodeService.post('/form', params).then((res:any) => {
  //   console.log(res)
  // })
}
</script>
